<?php
	session_start();
	include 'db.php'; //database config and connection
	include 'inc/header.php';
	include 'cartPrinter.php';
	
	if(!isset($_SESSION['salesName'])){
		header("location:saleslogin.php");
	}
	//this will control whether the discount row will show
	if(isset($_POST['discount']) && $_POST['discount'] > 0){
		$_SESSION['discounted'] = 'true';
	}else{
		$_SESSION['discounted'] = 'false';
	}
?>
<!DOCTYPE HTML>
<html>
    <head>
    <meta charset=utf-8>
    <title>LEDLAMPS</title>
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <script src="js/modernizr-1.7.min.js"></script><!-- this is the javascript allowing html5 to run in older browsers -->
    
    <link rel="stylesheet" type="text/css" href="css/reset.css" media="screen" title="html5doctor.com Reset Stylesheet" />
    
    <link rel="stylesheet" href="css/default.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" media="screen" />
    
    <!-- in the CSS3 stylesheet you will find examples of some great new features CSS has to offer -->
    <link rel="stylesheet" type="text/css" href="css/css3.css" media="screen" />
    
    <!-- general stylesheet contains some default styles, you do not need this, but it helps you keep a uniform style -->
    <link rel="stylesheet" type="text/css" href="css/general.css" media="screen" />
    
    <!-- grid's will help you keep your website appealing to your users, view 52framework.com website for documentation -->
    <link rel="stylesheet" type="text/css" href="css/grid.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="css/print.css" media="print, projection" />
    </head>
<body>

	<?php get_header('print','public'); ?>
    
    
    <!-- start printarea -->
     <div class="row box-align-center printarea">   
        <section id="section_to_print" class="col_16">
            <h2 class="align_center">Proforma Invoice</h2>
            <div class="customerWrap left">
                <p><?php echo $_SESSION['name']; ?><br>
                <?php echo $_SESSION['jobtitle']; ?><br>
                <?php echo $_SESSION['location']; ?><br>
                P.O Box <?php echo $_SESSION['PO']; ?><br>
                Dubai, UAE<br>
                Tel - <?php echo $_SESSION['number']; ?><br>
                Email - <?php echo $_SESSION['email']; ?><p>
            </div>
            <div class="detailWrap right">
                <p>Date - <?php $_SESSION['receiptDate'] = date('F j, Y'); echo $_SESSION['receiptDate'];   ?> <br>
                <span>P/INV - <?php echo $_SESSION['proformaID']; ?></span></p>
            </div>
            <div class="clear"></div>
            <p>Dear Sir/Ma'am; </p>
            <p>We are pleased to offer you our pricing for PHILIPS LED for the above mentioned project.</p>
            <?php 
				if(isset($_POST['discount'])){
					$discVal = $_POST['discount'];
					printCart($discVal);
				}else{
                	printCart(0);
				}
             ?>    
             <!--<p>
                <strong>Payment Terms:</strong> Cheque or Cash on Delivery<br>
                <strong>Validity:</strong> 15 Days<br>
                <strong>Warranty:</strong> <input type="text" name="warranty" value="" /><br>
                <strong>Bank Details:</strong> Cheque to be made on Anton W.C. Denker GMBH FZE
                
                
             </p>-->
             <style type="text/css">
			 	.proforma_table td{
					border-top:0 !important;
				}
             </style>
             
             <form method="POST" name="savePDF" action="saveCart.php">
             <table width="100%" border="0" class="table proforma_table">
             	
                <tr>
                	<td >Validity:</td>
                    <td>15 Days</td>
                </tr>
                <tr>
                	<td style="vertical-align:top;">Payment Terms:</td>
                    <td><textarea name="payterms" rows="2" style="width:300px;"></textarea></td>
                </tr>
                <tr>
                	<td>Delivery</td>
                    <td><input type="text" name="delivery" value="" style="width:300px;" /></td>
                </tr>
                <tr>
                	<td>Warranty</td>
                    <td><input type="text" name="warranty" value="" style="width:50px;" /></td>
                </tr>
                <tr>
                	<td>Remarks</td>
                    <td><textarea name="remarks" rows="2" style="width:300px;"></textarea></td>
                </tr>
                <tr>
                	<td colspan="2"><input type="hidden" name="cartid" value="<?php echo $cartID; ?>" /></td>
                </tr>
                <tr>
                	<td>
                    	<strong>Bank Details:</strong> 
                    </td>
                    <td>Cheque to be made on Anton W.C. Denker GMBH FZE</td>
                </tr>
             </table>
          	
             <div style="padding:20px; padding-bottom:0px;">
             	 <div class="row box-align-center col_16 non-printable">
    				<button class="btn btn-large btn-primary box-align-center printReceipt" >Save &amp; Download</button></a>
   				 </div>
             </div> 
                </form> 
             
                
        </section>
     </div>
    <!-- end printarea -->
   
    <footer class="row">
		<div class="col_16 col">all rights reserved &copy; <a href="#">LEDLAMPS</a> |  </div>
	</footer>
</body>
</html>